Skip to content

Fix clj-time.format/formatters - #21

Open
jbswetnam wants to merge 2 commits into
dscarpetti:masterfrom
jbswetnam:fix-time-formatter
Open

Fix clj-time.format/formatters#21
jbswetnam wants to merge 2 commits into
dscarpetti:masterfrom
jbswetnam:fix-time-formatter

Conversation

@jbswetnam

Copy link
Copy Markdown

Library currently crashes during load due to this issue.

`clj-time.format/formatter` does not accept a keyword argument (`:basic-date-time`). `formatters` is what is needed.
@dscarpetti

Copy link
Copy Markdown
Owner

Thanks for the PR.

I am curious under what circumstances the library is crashing? Does your project use an older version of clj-time (pre 0.12.0 or so) by chance? Around then clj-time.formatter/formatter was updated (and updated again) to allow keyword arguments.

That said, as we are using one of the default fomatters, so there may be some slight advantage in clarity and performance. I would just like to understand under what conditions this problem is manifesting/how to reproduce it.

@jbswetnam

Copy link
Copy Markdown
Author

You're right, it should work. As best I can tell, I'm using the version of clj-time specified in your project.clj ("0.13.0"). When I run lein deps :tree, the only reference to clj-time I see is from codax:

 [codax "1.2.0"]
   [clj-time "0.13.0"]
     [joda-time "2.9.7"]

I also tried putting the latest clj-time in my project.clj, and it still didn't work. Here's what happens in my REPL no matter which version I'm using:

user=> (require '[clj-time.format :as f])
nil
user=> (f/formatter :basic-date-time)

ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String  clj-time.format/formatter (format.clj:41)

I guess I'll have to do some more investigation on my end.

Great library, BTW! I was looking for something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants